-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclusively build for pwdata and filter out modules #3
Conversation
1dd5e54
to
eaf8005
Compare
eaf8005
to
fcefe35
Compare
1f1a299
to
bc8ec6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small comments. I just want to make sure I understand what's happening here.
pycg/processing/preprocessor.py
Outdated
if src_name.split(".")[0] not in self.exclusives: | ||
continue | ||
|
||
# Skip ignored modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to skip ignored modules down here and remove them from times above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below is what happens when PyCG looks at an import declaration, the other ... in self.ignored_mods:
case above is when we visit a module. I did this as a safety precaution more so I think PyCG could end up traversing through a ignored modules in both cases - though I could be wrong about this and we can test.
pycg/processing/preprocessor.py
Outdated
@@ -205,6 +215,14 @@ def add_external_def(name, target): | |||
tgt_name = import_item.asname if import_item.asname else import_item.name | |||
imported_name = self.import_manager.handle_import(src_name, level) | |||
|
|||
# Limit to exclusive module | |||
if src_name.split(".")[0] not in self.exclusives: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here if self.exclusives is None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I'll add their default to be an empty array.
This way we can pass in
["pwdata"]
as a exclusive package to filter by and then skip all the Pipeline classes asignored_mods
.